package cn.vc.content.util;

import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.stp.StpUtil;
import cn.vc.auth.entity.po.VUser;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description:
 * @Author: mo
 * @Date: 2024-03-23 11:36
 **/
@Slf4j
public class SecurityUtil {
    // KEY{ID}
    public final static String AUTH_USER_KEY = "auth_user:";

    public static VUser getUser() throws NotLoginException {
        try {
            return (VUser) StpUtil.getSession().get("user");
        } catch (NotLoginException e) {
            return null;
        }

    }
}
